//
//  detailViewController.m
//  Project_A
//
//  Created by running on my way on 15/1/16.
//  Copyright (c) 2015年 Flowers. All rights reserved.
//

#import "detailViewController.h"
#import "UIImageView+WebCache.h"




@interface detailViewController ()

@end

@implementation detailViewController
- (void)dealloc
{
    [_name release];
    [_albumId release];
    [_Pic release];
    [_playNam release];
    [_introduce release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    //创建scrollView
    self.scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    [self.view addSubview:self.scrollView];
    self.scrollView.contentSize = CGSizeMake(375, 800);
    //self.scrollView.backgroundColor = [UIColor whiteColor];
    self.scrollView.backgroundColor = [UIColor colorWithRed:254/256.0 green:246/256.0 blue:226/256.0 alpha:0.3];
    [self creatSubView];
}
//页面
- (void)creatSubView
{
    //图片
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 100, 150)];
    imageView.backgroundColor = [UIColor clearColor];
    [self.scrollView addSubview:imageView];
    NSURL *url = [NSURL URLWithString:self.Pic];
    [imageView sd_setImageWithURL:url];
    [imageView release];
    //书名
    UILabel *nameLab = [[UILabel alloc] initWithFrame:CGRectMake(imageView.frame.origin.x + imageView.frame.size.width + 10 , imageView.frame.origin.y, 200, 30)];
    nameLab.backgroundColor = [UIColor clearColor];
    nameLab.text = self.name;
    [self.scrollView addSubview:nameLab];
    [nameLab release];
    //播放次数
    UILabel *playNumLab = [[UILabel alloc] initWithFrame:CGRectMake(nameLab.frame.origin.x, nameLab.frame.origin.y + 40, 200, 30)];
    playNumLab.backgroundColor = [UIColor clearColor];
    playNumLab.text = [NSString stringWithFormat:@"%@ %@ %@", @"播放次数:", self.playNam, @"次"];
    [self.scrollView addSubview:playNumLab];
    [playNumLab release];
    //专辑个数
    UILabel *numLab = [[UILabel alloc] initWithFrame:CGRectMake(playNumLab.frame.origin.x, playNumLab.frame.origin.y + 40, 200, 30)];
    numLab.text = @"本专辑音频总数:";
    numLab.backgroundColor = [UIColor clearColor];
    [self.scrollView addSubview:numLab];

    [numLab release];
    UILabel *downLab = [[UILabel alloc] initWithFrame:CGRectMake(numLab.frame.origin.x, numLab.frame.origin.y + 40, 200, 30)];
    downLab.backgroundColor = [UIColor clearColor];
    [self.scrollView addSubview:downLab];
    downLab.text = [NSString stringWithFormat:@"%@ %@ %@ ",@"下载次数:", self.albumId, @"次"]; 
    
    [downLab release];
    
    UIButton *listButton = [UIButton buttonWithType:UIButtonTypeCustom];
    listButton.frame = CGRectMake(imageView.frame.origin.x, downLab.frame.origin.y + 50, 340, 30);
    [listButton setTitle:@"专辑播放列表" forState:UIControlStateNormal];
    listButton.backgroundColor = [UIColor greenColor];
    [listButton addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];
    [self.scrollView addSubview:listButton];
    //简介Label
    UILabel *introduceLab = [[UILabel alloc] initWithFrame:CGRectMake(listButton.frame.origin.x + 10, listButton.frame.origin.y + 50, 340, 300)];
    introduceLab.backgroundColor = [UIColor clearColor];
    [self.scrollView addSubview:introduceLab];
    introduceLab.numberOfLines = 0;
    introduceLab.text = self.introduce;
    [introduceLab release];
    
}


- (void)buttonAction
{
    AudioViewController *audioView = [[AudioViewController alloc] init];
    audioView.type = self.albumId;
    [self.navigationController pushViewController:audioView animated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
